<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <!-- <h2 :style="{key(属性名): value(属性值)}">{{message}}</h2>-->
    <!-- 'italic'必须加上单引号，否则是当做一个变量去解析-->
    <h2 :style="{fontStyle: 'italic'}">{{message}}</h2>
    <h2 :style="{fontStyle: italic}">{{message}}</h2>
    <h2 :style="{fontStyle: italic, fontSize: finalSize + 'px'}">{{message}}</h2>
    <h2 style="color: #ff0000" :style="getStyles()">{{message}}</h2>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
    const app = new Vue({
        el: '#app',
        data: {
            message: 'simplelu',
            finalSize: 50,
            italic: 'italic'
        },
        methods: {
            getStyles: function () {
                return {fontStyle: this.italic, fontSize: this.finalSize + 'px'}
            }
        }
    })
</script>
</body>
</html>